<template>
  <el-table
    :data="volunteerList"
    :header-cell-style="{ backgroundColor: '#f0f0f0' }"
  >
    <el-table-column prop="title" label="志愿表" width="120px" align="center" />
    <!-- <el-table-column prop="rate" label="靠谱率" align="center">
      <template #default="scope">
        {{ scope.row.rate || '-' }}
      </template>
    </el-table-column> -->
    <el-table-column prop="batch" label="批次" align="center" width="200px">
      <template #default="scope">
        {{ scope.row.batch || '-' }}
      </template>
    </el-table-column>
    <el-table-column prop="score" label="成绩" align="center">
      <template #default="scope">
        {{ scope.row.score || '-' }}
      </template>
    </el-table-column>
    <el-table-column prop="sgname" label="科目" align="center">
      <template #default="scope">
        {{ scope.row.sgname || '-' }}
      </template>
    </el-table-column>
    <el-table-column prop="zyType" label="类型" align="center">
      <template #default="scope">
        {{
          scope.row.createFrom == 1
            ? '专家填报'
            : scope.row.zyType == '1'
              ? '自主填报'
              : '一键填报'
        }}
      </template>
    </el-table-column>
    <el-table-column
      prop="lastModificationTime"
      label="最后编辑时间"
      width="165"
      align="center"
    >
      <template #default="scope">
        {{ scope.row.lastModificationTime || '-' }}
      </template>
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      :width="isShowOptionItem ? 180 : 60"
      align="center"
    >
      <template #default="spoce">
        <el-button
          link
          type="primary"
          size="small"
          @click="onClickOptionItem(spoce.$index, 0, spoce.row.status)"
          >查看</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>
<script setup>
const emit = defineEmits(['onClickOptionItem']);

const { volunteerList, isShowOptionItem } = defineProps({
  volunteerList: {
    type: Array,
    default: () => [],
  },
  isShowOptionItem: {
    type: Boolean,
    default: true,
  },
});

/**
 * 点击志愿表操作选项
 * @param {Number} index 下标
 * @param {Number} type 操作类型 0-删除 1-最终方案 2-同步至学生 3-删除
 */
function onClickOptionItem(index, type, status) {
  emit('onClickOptionItem', index, type, status, '2'); //2-专家
}
</script>
<style lang="scss" scoped></style>
